define(['modules/fetch'],function(fetch){

    function loadSidebarData(param, f){
       fetch('listStory', { limit: 20, offset: 0},
            function (result) {
                if(0 == result.errno ){
                    vueSidebarData.listbarList = result.data;
                    console.log(vueSidebarData);
                }
            },
            function(data) {
                console.log("ajax faild");
            }
        );
    }
    var vueSidebarData = {
        listbarList:[],
    };
    new Vue({
        el: "#sidebar",
        data: vueSidebarData,
        methods:{
            sidebarItemClick: function(index,item, currentId){
                if(currentId == item.story_id){
                    return false;
                }
                location.href="/story/readStory?story_id=" + parseInt(item.story_id);
                console.log(index,item);
            }
        }
    });
    return loadSidebarData;
});